<?php

namespace app\xcxapi\controller\v1;

use app\common\controller\XcxController;
use app\xcxapi\service\GradesService;

class Grades extends XcxController
{
    /**
     * 班级列表
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function gradesLists()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->gradesLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
     * 插入学员
     * User: chenben
     * Date: 2020/04/18.
     */
    public function insertStudentTable()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->insertStudentTable($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	/**
     * 修改排课
     * User: chenben
     * Date: 2020/04/18.
     */
    public function getGradesInfo()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->getGradesInfo($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	 /**
     * 分班
     * User: chenben
     * Date: 2020/04/18.
     */
    public function classAssignment()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->classAssignment($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
	
	/**
     * 班级结业
     * User: chenben
     * Date: 2020/04/18.
     */
    public function gradesDel()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->gradesDel($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 新增班级
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function gradesAdd()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->gradesAdd($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 获取班级信息
     * User: wufeng
     * Date: 2020/02/11.
     */
    public function achieveGradesInfo()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->achieveGradesInfo($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 编辑班级
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function gradesEdit()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->gradesEdit($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	 /**
     * 新增班级
     * User: chenben
     * Date: 2020/04/15.
     */
    public function addclassdata()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->addclassdata($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 班级详情/课表/学员列表/
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function gradesDetail()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->gradesDetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 添加学员
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
    public function addStudent()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new GradesService($this->type))->addStudent($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

    /**
     * 点名上课列表
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function rollCallLists()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->rollCallLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 点名上课
     * User: wufeng
     * Date: 2020/01/11.
     */
    public function rollCall()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new GradesService($this->type))->rollCall($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 获取数据列表
	 * 课程/班主任/任课老师/助教
	 * 常用时间段/开始/结束/时长/教室
	 * User: wufeng
	 * Date: 2020/04/10
	 *
	 */
    public function getDataLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new GradesService($this->type))->getDataLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
}
